package com.bidcms.web.model;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.digester.Digester;
import org.springframework.stereotype.Controller;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.bidcms.util.VerifyCodeHelper;
import com.google.gson.JsonObject;

@Controller
@RequestMapping("models/account")
public class account {

	@ResponseBody
	@RequestMapping(value="team/category" ,method=RequestMethod.GET)
	public String category(HttpServletRequest req,HttpServletResponse resp){
		
		return "{\"code\":0,\"msg\":\"\",\"data\":[{\"id\":\"2\",\"name\":\"\u5973\u88c5\"},{\"id\":\"3\",\"name\":\"\u7537\u88c5\"},{\"id\":\"4\",\"name\":\"\u7f8e\u5986\u62a4\u80a4\"},{\"id\":\"5\",\"name\":\"\u7537\u978b\"},{\"id\":\"6\",\"name\":\"\u7bb1\u5305\"},{\"id\":\"7\",\"name\":\"\u6bcd\u5a74\u73a9\u5177\"},{\"id\":\"8\",\"name\":\"\u98df\u54c1\u7279\u4ea7\"},{\"id\":\"9\",\"name\":\"\u5bb6\u5c45\u5bb6\u7eba\"},{\"id\":\"10\",\"name\":\"\u521b\u610f\u793c\u54c1\"},{\"id\":\"11\",\"name\":\"3C\u6570\u7801\"},{\"id\":\"12\",\"name\":\"\u5973\u978b\"},{\"id\":\"14\",\"name\":\"\u7537\u5973\u5185\u8863\"},{\"id\":\"15\",\"name\":\"\u8fd0\u52a8\u6237\u5916\"},{\"id\":\"16\",\"name\":\"\u7ae5\u88c5\u7ae5\u978b\"},{\"id\":\"17\",\"name\":\"\u73e0\u5b9d\u9996\u9970\"},{\"id\":\"18\",\"name\":\"\u65e5\u7528\u767e\u8d27\"},{\"id\":\"19\",\"name\":\"\u6c7d\u8f66\u914d\u4ef6\"},{\"id\":\"20\",\"name\":\"\u533b\u836f\u4fdd\u5065\"},{\"id\":\"21\",\"name\":\"\u751f\u6d3b\u670d\u52a1\"},{\"id\":\"22\",\"name\":\"\u5a92\u4f53\u670d\u52a1\"},{\"id\":\"23\",\"name\":\"\u88c5\u4fee\u5efa\u6750\"},{\"id\":\"24\",\"name\":\"\u670d\u88c5\u914d\u9970\"},{\"id\":\"25\",\"name\":\"\u5bb6\u7528\u7535\u5668\"},{\"id\":\"1\",\"name\":\"\u7efc\u5408\u5176\u4ed6\"}]}";
	}
	
	@ResponseBody
	@RequestMapping(value="user/login" ,method=RequestMethod.POST)
	public String userLogin(HttpServletRequest req,HttpServletResponse resp){
		JsonObject json = new JsonObject();
		String account  = req.getParameter("account");
		String password= req.getParameter("password")==null?"":org.apache.commons.codec.digest.DigestUtils.md5Hex(req.getParameter("password"));
		String captcha_code= req.getParameter("captcha_code");
		String auto_login = req.getParameter("auto_login");
		if(VerifyCodeHelper.check(req.getSession(), captcha_code));
			return "{\"code\":10101,\"msg\":\"验证码错误\"}";
		//
	}
}
